﻿<Window x:Class="KinectCamViewer.KinectCamViewerUI"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="700" d:DesignWidth="960" Background="AliceBlue" MinHeight="700" MinWidth="960" Icon="Kinect.ico" Title="Kinect Frame Viewer">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="90*" />
            <ColumnDefinition Width="848*" />
        </Grid.ColumnDefinitions>
        <Button  Content="Load from file" Height="23" HorizontalAlignment="Left" Margin="33,12,0,0" Name="_openFile" VerticalAlignment="Top" Width="95" Click="_openFile_Click" Grid.Column="1" />
        <Button  Content="|&lt;" Height="23" HorizontalAlignment="Left" Margin="49,63,0,0" Name="_firstFrame" VerticalAlignment="Top" Width="30" Click="_firstFrame_Click" />
        <Button  Content="&lt;" Height="23" HorizontalAlignment="Left" Margin="9,63,0,0" Name="_prevFrame" VerticalAlignment="Top" Width="30" Click="_prevFrame_Click" Grid.Column="1" />
        <ToggleButton  Content="Play" Height="23" HorizontalAlignment="Left" Margin="59,63,0,0" Name="_playButton" VerticalAlignment="Top" Width="45" Checked="Play_Checked" Unchecked="_playButton_Unchecked" Grid.Column="1" />
        <Button  Content=">" Height="23" HorizontalAlignment="Left" Margin="124,63,0,0" Name="_nextFrame" VerticalAlignment="Top" Width="30" Click="_nextFrame_Click" Grid.Column="1" />
        <Button  Content=">|" Height="23" HorizontalAlignment="Left" Margin="174,63,0,0" Name="_lastFrame" VerticalAlignment="Top" Width="30" Click="_lastFrame_Click" Grid.Column="1" />
        <Image Height="240" HorizontalAlignment="Left" Margin="18,130,0,0" Name="_webCamImage" Stretch="Fill" VerticalAlignment="Top" Width="320" Grid.ColumnSpan="2" />
        <Image Height="240" HorizontalAlignment="Left" Margin="18,384,0,0" Name="_depthCamImage" Stretch="Fill" VerticalAlignment="Top" Width="320" Grid.ColumnSpan="2" />
        <Label Content="Frame:" Height="28" HorizontalAlignment="Left" Margin="45,92,0,0" Name="label1" VerticalAlignment="Top" />
        <Label Content="0" Height="28" HorizontalAlignment="Left" Margin="9,92,0,0" Name="_frameCount" VerticalAlignment="Top" Width="54" HorizontalContentAlignment="Right" Grid.Column="1" />
        <Label Content="Jump to:" Height="28" HorizontalAlignment="Left" Margin="111,92,0,0" Name="label2" VerticalAlignment="Top" Grid.Column="1" />
        <Label Content="/ 0" Height="28" HorizontalAlignment="Left" Margin="57,92,0,0" Name="_maxFrames" VerticalAlignment="Top" Grid.Column="1" />
        <ComboBox  Height="23" HorizontalAlignment="Left" Margin="178,92,0,0" Name="_selectFrame" VerticalAlignment="Top" Width="70" SelectionChanged="_selectFrame_SelectionChanged" Grid.Column="1" />

        <Grid Height="494" HorizontalAlignment="Left" Margin="275,118,0,0" Name="_3DViewGrid" VerticalAlignment="Top" Width="555" 
              MouseDown="_3DViewGrid_MouseDown" MouseMove="_3DViewGrid_MouseMove" MouseUp="_3DViewGrid_MouseUp" MouseWheel="_3DViewGrid_MouseWheel" Grid.Column="1">
            <Viewport3D x:Name="mainViewport" >
                <Viewport3D.Camera>
                    <PerspectiveCamera x:Name="camera" FarPlaneDistance="10000" LookDirection="0,0,1"
					UpDirection="0,1,0" NearPlaneDistance="0" Position="0,0,-1"
					FieldOfView="78" />
                </Viewport3D.Camera>

                <ModelVisual3D x:Name="model">
                    
                    <ModelVisual3D.Content>
                        <Model3DGroup x:Name="group">
                            <AmbientLight Color="DarkGray" />
                            <DirectionalLight Color="White" Direction="0,-1,0" />
                                
                        </Model3DGroup>
                        

                    </ModelVisual3D.Content>
                </ModelVisual3D>

                <ModelVisual3D>
                    <ModelVisual3D.Content>

                        <GeometryModel3D>

                            <GeometryModel3D.Geometry>

                                <MeshGeometry3D x:Name="meshMain"

                             Positions="40 40 40  -40 40 40  40 -40 40  -40 -40 40  40 40 -40  -40 40 -40  40 -40 -40  -40 -40 -40"

                             TriangleIndices="2 3 1  2 1 0  7 1 3  7 5 1  6 5 7  6 4 5  6 2 0  2 0 4  2 7 3  2 6 7  0 1 5  0 5 4">

                                </MeshGeometry3D>

                            </GeometryModel3D.Geometry>

                            <GeometryModel3D.Material>

                                <DiffuseMaterial x:Name="matDiffuseMain">

                                    <DiffuseMaterial.Brush>

                                        <SolidColorBrush Color="AliceBlue"/>

                                    </DiffuseMaterial.Brush>

                                </DiffuseMaterial>

                            </GeometryModel3D.Material>

                        </GeometryModel3D>


                    </ModelVisual3D.Content>
                    
                </ModelVisual3D>

            </Viewport3D>

        </Grid>
        <Button   Content="3D Render" Height="23" HorizontalAlignment="Left" Margin="374,92,0,0" Name="_render3D" VerticalAlignment="Top" Width="75" Click="_render3D_Click" Grid.Column="1" />
        <CheckBox  Content="Always render in 3D" Height="16" HorizontalAlignment="Left" Margin="479,99,0,0" Name="_renderCheck" VerticalAlignment="Top" Grid.Column="1" />
    </Grid>
</Window>
